import { createStore } from 'vuex'
import createPersistedState from "vuex-persistedstate"

import user from "./modules/user"
import cart from "./modules/cart"
import category from "./modules/category"

export default createStore({
  modules: {
    user,
    cart,
    category
  },
  plugins: [
    // 默认存储在localstorage
    createPersistedState({
      // 本地储存key
      key: "user-store",
      //指定要储存的模块
      paths: ["user", "cart"]
    })
  ]
})
